package com.bank.basic.pojo;

import com.bank.common.resultUtil.ResultCodeEnum;

/**
 * The type Permission com.bank.user.handler.
 *
 * @author Cejay1314
 * @version 1.0
 * @create 2023 /2/18 20:18
 */
public class PermissionHandler implements AuthorityHandler{
    private AuthorityHandler next;

    /**
     * Instantiates a new Permission com.bank.user.handler.
     */
    public PermissionHandler() {
    }

    /**
     * Instantiates a new Permission com.bank.user.handler.
     *
     * @param next the next
     */
    public PermissionHandler(AuthorityHandler next) {
        this.next = next;
    }

    @Override
    public void setNext(AuthorityHandler authorityHandler) {
        this.next = authorityHandler;
    }

    @Override
    public ResultCodeEnum handle(String data) {
        if(data.equals("1")){
            if(next!=null) return next.handle(data);
            return ResultCodeEnum.SUCCESS;
        }
        return ResultCodeEnum.FAIL;
    }
}
